function fashionStar() {

    function search() {
        $('header .search a').click(function() {
            window.location.href = 'search.html';
        })
    }
    search();

    $('.nav-ul span').click(function() {

        //console.log($('swiper-pagination-bullet-actice').index());

        // console.log($(this).index());

        /*  $(this).css({
             'color': '#010101',
             'border-bottom': '0.04rem solid #101010'
         }).siblings().css({
             'color': '#999',
             'border-bottom': '0'
         }); */
        switch ($(this).index()) {
            case 1:
                shuJu('mx');
                break;
            case 2:
                shuJu('sp');
                break;
            case 3:
                shuJu('hw');
                break;
            case 4:
                shuJu('hb');
                break;
            default:
                break;
        }

    });

    // console.log($('section .swiper-slide').length);
    // console.log($('.nav-ul li').length);
    // $('section .swiper-slide').mousedown(function(){
    // 	console.log($(this).index());
    // })
    //console.log($('.swiper-pagination span').text());

    $('.nav-ul span').eq(0).text('综合').css({
        'width': '0.60rem',
    })
    $('.nav-ul span').eq(1).text('明星').css({
        'width': '0.60rem'
    })
    $('.nav-ul span').eq(2).text('视频').css({
        'width': '0.60rem'
    })
    $('.nav-ul span').eq(3).text('买手好货').css({
        'width': '1.20rem'
    })
    $('.nav-ul span').eq(4).text('直播红包').css({
        'width': '1.20rem'
    })


    $.post(showHeadline, {
        type: "dj"
    }, res => {
        console.log(res.info);
        let html = res.info.map(v => `
        <dl>
                        <dt>
								<img src="${v.imgUrl}">
							</dt>
                        <dd>
                            <div class="dd-top">
                                <div class="dd-top-l">
                                    独家
                                </div>
                                <div class="dd-top-r">
                                    <p>${v.title}</p><span>2019-9-9</span>
                                </div>
                            </div>
                            <div class="dd-bottom">
                                <div class="dd-bottom-l">
                                    <div class="dd-bottom-l-l">
                                        <a href="#"><img src="../img/huoHua.jpg" alt="" srcset=""></a>
                                        <span>${v.pageView}</span>
                                    </div>
                                    <div class="dd-bottom-l-r">
                                        <a href="#" class="iconfont icon-Group-"></a>
                                        <span>${v.commentCount}</span>
                                    </div>

                                </div>
                                <div class="dd-bottom-r">
                                    <a href="#"><img src="../img/fenXiang.jpg" alt=""></a>
                                </div>
                            </div>
                        </dd>
                    </dl>
        
        `).join('');
        $('.dj-cont').html(html);

    })


    /*    <
       span class = "swiper-pagination-bullet swiper-pagination-bullet-active"
       style = "width: 0.6rem;" > 视频 < /span> */




    $("#swiper1").on("touchstart", function(e) {

        // 判断默认行为是否可以被禁用
        if (e.cancelable) {
            // 判断默认行为是否已经被禁用
            if (!e.defaultPrevented) {
                e.preventDefault();
                //  console.log($('.swiper-slide-active').index());
                // console.log($('.swiper-slide-next').index());
                switch ($('.swiper-slide-next').index()) {
                    case 1:

                        shuJu('mx');
                        break;
                    case 2:
                        shuJu('sp');
                        break;
                    case 3:
                        shuJu('hw');
                        break;
                    case 4:
                        shuJu('hb');
                        break;
                    default:
                        break;
                }





            }
        }
        // console.log($('.swiper-slide-prev'));
    });

    //console.log($('.swiper-slide-active').css('height'));
    // console.log($('.swiper-slide-prev'));




}


function shuJu(type) {



    $.post(showHeadline, {
        type: type
    }, res => {
        //console.log(res);
        let html = res.info.map(v => `

        <dl>
        <dt>
                <img src="${v.imgUrl}">
            </dt>
        <dd>
            <div class="dd-top">
                <div class="dd-top-l">
                    独家
                </div>
                <div class="dd-top-r">
                    <p>${v.title}</p><span>2019-9-9</span>
                </div>
            </div>
            <div class="dd-bottom">
                <div class="dd-bottom-l">
                    <div class="dd-bottom-l-l">
                        <a href="#"><img src="../img/huoHua.jpg" alt="" srcset=""></a>
                        <span>${v.pageView}</span>
                    </div>
                    <div class="dd-bottom-l-r">
                        <a href="#" class="iconfont icon-Group-"></a>
                        <span>${v.commentCount}</span>
                    </div>

                </div>
                <div class="dd-bottom-r">
                    <a href="#"><img src="../img/fenXiang.jpg" alt=""></a>
                </div>
            </div>
        </dd>
    </dl>
`).join('');
        $('.' + type + '-cont').html(html);
        /*  $('.' + type + '-cont').parent().attr('id');

         console.log($('.' + type + '-cont').parent().attr('id')) */
        /* 正向滑动时间 高度自适应 */
        //  console.log($('.' + type + '-cont').css('height'));
        // console.log($('.' + type + '-cont').parent().index())
        let Height = parseInt($('.' + type + '-cont').css('height'));
        // console.log(Height)

        // console.log($('#swiper1').css('height'))

        $('#swiper1').css({
            'height': Height + 153 + 'px'
        })

    })
}



function f() {
    var slideArr;
    var slideHeightArr = []; //slide的高度数组

    var loadTimer = setInterval(function() {
        var state = document.readyState.toLocaleLowerCase();
        if (state === 'complete') {
            //获取slide高度数组
            slideArr = $('.swiper-container .swiper-slide');
            $('.swiper-container .swiper-slide').wait
            $.each(slideArr, function(index, item) {
                slideHeightArr[index] = $(item).height();
            });
            // console.log(slideHeightArr);

            clearInterval(loadTimer);
        }
    }, 500);


    //console.log($('.swiper-slide').eq(1).hasClass('swiper-slide-active'));

}